<?php  
class AuthController extends Controller{
	public function __construct(){
		parent::__construct();
		//未登录用户  跳转登录页面
		if (!isset($_SESSION['user']['uid'])) {
			go('Login/login');
		}
	}
	
	/**
	 * 验证权限
	 * @return [type] [description]
	 */
	protected function access(){
		//站长无权限限制
		if ($_SESSION['user']['username']==C('WEB_MASTER')) {
			return true;
		}
		
		$map['rid']=$_SESSION['user']['rid'];
		$map['module']=MODULE;
		$map['controller']=CONTROLLER;
		$map['action']=ACTION;

		if (!M('access')->where($map)->all()) {
			$this->error('没有操作权限');
		}
	}
}
?>